package com.hex.liyue.giftmodule.presenter;

import com.hex.liyue.commonmodule.manager.HttpManager;
import com.hex.liyue.commonmodule.manager.UserManager;
import com.hex.liyue.commonmodule.net.ResponseListener;
import com.hex.liyue.commonmodule.utils.L;
import com.hex.liyue.giftmodule.bean.DiscountGiftsBean;
import com.hex.liyue.giftmodule.bean.HarvesGiftsBean;

import java.io.Serializable;
import java.util.List;


/**
 * Created by $cmm on 2016/6/21.
 * <p/>
 * 收货的礼物列表的业务类
 */
public class HarvesGiftsPresenter {
    private IHarvesGiftsView iHarvesGiftsView;

    public HarvesGiftsPresenter(IHarvesGiftsView iHarvesGiftsView) {
        this.iHarvesGiftsView = iHarvesGiftsView;
    }

    public void getHarvesGifts(int page,int pagenum) {
        iHarvesGiftsView.showLod("加载中...");
        HttpManager.getInstance().getHarvesGifts(UserManager.getUserId(),page,pagenum, new ResponseListener<HarvesGiftsBean>() {
            @Override
            public void onSuccess(HarvesGiftsBean harvesGiftsBean) {
                L.e("discountGiftsBean", harvesGiftsBean.toString());
                iHarvesGiftsView.closeLod();
                iHarvesGiftsView.setAdapter(harvesGiftsBean);
            }

            @Override
            public void onFailure(String responseresult) {
                iHarvesGiftsView.closeLod();
                iHarvesGiftsView.showT(responseresult);
            }
        });
    }
}